<template>
	<view class="content">
		<!-- 购买说明 -->
		<view class="header" v-if="goods" :style="'background: url(https://hdyfs.languowangluo.cn'+ goods.card_banner + ') repeat 0 0 / 100% auto;'">
			<view class="head">
				<view class="status_bar" :style="'height:'+ statusBarHeight +'px;'"></view>
				<view class="header_title">
					<view @click="back()">
						<image :src="z_imgPath + 'back.png'"></image>返回
					</view>
					<view class="hang1">{{goods.title}} </view>
				</view>
			</view>

			<view class="redu">
				<view> 收集进度: <text>{{goods.hove_count}}</text> /{{goods.count}}</view>
				<view>
					<cmd-progress :percent="goods.gailv" :show-info="false" stroke-color="#1AC762" :strokeWidth="10">
					</cmd-progress>
				</view>
			</view>
		</view>

		<mescroll-body ref="mescrollRef" style="min-height: auto;" @init="mescrollInit" :down="downOption"
			@down="downCallback" @up="upCallback">
			<view class="title_ipt">
				<image :src="z_imgPath+'search.png'"></image>
				<input type="text" placeholder="请输入关键字" placeholder-style="color:rgba(255,255,255,0.6)"
					onfirm-type="search" v-model="keyword" @confirm="show='',loadData(1)" />
				<view>搜索</view>
			</view>
			<view class="qiehuan">
				<view @click="getlist(i,'')" v-for="(v,i) in arr" :key="i">
					<view :class="show==i?'xzs':'wzs'">{{v}}</view>
					<view class="qiehuan_line" v-if="show==i"> </view>
				</view>
			</view>
			<view class="cate">
				<view v-for="(item,index) in shang_cate" :key="index" :class="item.id==shang_id?'cate_sel':''"
					@click="getlist(show,item.id)">{{item.title}}</view>
			</view>
			<!-- 赏池预览 -->
			<view class="shop" v-if="goodslist && goodslist.length>0">
				<view v-for="(item,index) in goodslist" :key="index" class="shop_item">
					<!-- @click="change_sel(index,item.is)" -->
					<view class="item_head" @click="yulan(item)">
						<image :src="'https://hdyfs.languowangluo.cn'+item.imgurl" mode="aspectFill"></image>
						<!-- <view class="hang1">{{item.prize_code}}</view> -->
						<!-- <view v-if="item.is==1">X{{item.num}}</view>
						<view class="mengban" v-else></view> -->
					</view>
					<view class="shop_con">
						<view class="hang1" style="color: #FFFFFF;">{{item.title}}</view>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				z_imgPath: this.$z_img1 + 'chouka/',
				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
				goods_id: '', //商品id
				goodslist: [],
				goods: {},
				downOption: {
					auto: false
				},
				// 中赏记录
				shang_cate: [],
				shang_id: '',
				// 
				keyword: '',
				//暂时不要 , '保险柜'
				arr: ['全部', '已拥有', '未拥有'],
				show: 0
			}
		},

		onLoad(v) {
			this.goods_id = v.caId
			this.getShang()
		},

		onShareAppMessage() {
			let that = this;
			return {
				title: "快来简单模玩~",
				imageUrl: that.goods.imgurl,
				path: "/pages/chouka/index"
			};
		},
		methods: {
			getShang(){
				let that = this;
				that.req({
					url: 'card_level',
					success(res) {
						if (res.status == 1) {
							that.shang_cate=res.data
						}
					}
				})
			},

			getlist(v, a) {
				this.is_quan = false
				this.show = v;
				this.shang_id = a ? a : ''
				this.goodslist = []
				this.mescroll.resetUpScroll()
			},
			back() {
				uni.navigateBack()
			},
			downCallback() {
				this.mescroll.resetUpScroll(false)
			},
			upCallback(page) {
				this.loadData(page.num);
			},
			loadData(pageNo) {
				let that = this;
				that.req({
					url: 'card_book',
					data: {
						page: pageNo,
						card_id: that.goods_id,
						shang_id: that.shang_id,
						title: that.keyword,
						type: that.show
					},
					success(res) {
						if (res.status == 1) {
							if (res.status == 0) {
								setTimeout(() => {
									uni.navigateBack()
								}, 1500)
							}
							if (res.status == 1) {
								that.goods = res.data.card_goods
								// that.shang_cate = res.data.category
								that.count = res.data.goods_list.total
								that.post = res.data.yuefei
								console.log(that.post)
								that.mescroll.endByPage(res.data.goods_list.data.length, res.data.goods_list.last_page);
								// console.log(res.data.data)
								if (pageNo == 1) {
									that.goodslist = res.data.goods_list.data;
								} else {
									that.goodslist = that.goodslist.concat(res.data.goods_list.data);
								}
								
								if (that.is_quan) {
									for (let i = 0; i < that.goodslist.length; i++) {
										that.$set(that.goodslist[i], 'number', that.goodslist[i].num)
									}
								} else {
									for (let i = 0; i < that.goodslist.length; i++) {
										that.$set(that.goodslist[i], 'number', 0)
									}
								}
							}
						}
					}
				})
			},

		}
	}
</script>

<style>
	.yulanStyle image:nth-of-type(1) {
		width: 550rpx;
		/* height: 550rpx; */
	}

	.yulanStyle>view:nth-of-type(2) {
		border: 10rpx solid #FF7514;
		box-sizing: border-box;
		margin-bottom: 20rpx;
		margin-top: 10rpx;
		overflow: hidden;
	}

	.yulanStyle>view:nth-of-type(1) {
		font-size: 32rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #080808;
		line-height: 52rpx;
		-webkit-text-stroke: 3rpx #FFFFFF;
		text-stroke: 3rpx #FFFFFF;
		background: #FF7514;
		padding: 6rpx 20rpx;
		width: fit-content;
	}

	.yulanStyle {
		font-size: 47rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #FFFFFF;
		text-align: center;
	}

	textarea {
		width: 100%;
		height: 120rpx;
		background: rgba(255, 255, 255, 0.08);
		border-radius: 10rpx;
		padding: 4rpx 10rpx;
		margin-top: 20rpx;
		font-size: 26rpx;
		box-sizing: border-box;
	}

	.kuaidi_text {
		font-size: 24rpx;
		color: #999999;
	}

	.kuaidi>view:nth-of-type(2) {
		font-size: 28rpx;
	}

	.kuaidi>view:nth-of-type(1) {
		border-bottom: 1px solid #666666;
		padding: 20rpx 0;
	}

	.kuaidi>view {
		margin-top: 20rpx;
	}

	.kuaidi image {
		width: 32rpx;
		height: 32rpx;
	}

	.kuaidi {
		padding: 0 30rpx 30rpx 30rpx !important;
		color: #ffffff;
	}

	.order_title>image {
		width: 164rpx;
		height: 29rpx;
		position: absolute;
		left: 30rpx;
		top:20rpx;
	}

	.order_title {
		font-size: 50rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #FFFFFF;
		position: relative;
		text-align: right;
	}

	.order {
		width: 750rpx;
		background: rgba(0, 0, 0, 0.9);
		border-radius: 30rpx 30rpx 0px 0px;
		border-top: 5rpx solid #35ED85;
		border-bottom: none;
		position: absolute;
		bottom: 0;
		padding: 10rpx 30rpx 50rpx;
		box-sizing: border-box;
		color: #FFFFFF;
	}

	.pop_huishou {
		width: 610rpx;
		height: 70rpx;
		margin: 48rpx auto 0;
		display: block;
	}

	.xuyuan_foot {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		padding: 30rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		text-shadow: 0px 0px 14rpx #FF2121;
	}

	.xuyuan_item_2 {
		color: #ffffff;
		font-size: 24rpx;
		margin-top: 6rpx;
		width: 100%;
	}


	.shop_item_img>view:nth-of-type(1) {
		position: absolute;
		bottom: 0;
		left: 0;
		font-size: 20rpx;
		padding: 2rpx 20rpx 2rpx 10rpx;
		box-sizing: border-box;
		background: #FF7514;
		border-radius: 0 8rpx 0 0;
	}

	.shop_item_img>image {
		width: 100%;
		height: 100%;
		border-radius: 8rpx;
		position: absolute;
		top: 0;
		left: 0;
	}

	.shop_item_img {
		width: 170rpx;
		height: 170rpx;
		border-radius: 10rpx 10rpx 0 0;
		position: relative;
		text-align: left;
		box-sizing: border-box;
		overflow: hidden;
	}

	.xuyuan_item {
		width: 170rpx !important;
		min-width: 170rpx;
		height: 242rpx;
		margin-right: 20rpx;
		flex-shrink: 0;
		text-align: center;
		position: relative;
		margin-top: 20rpx;
	}

	.xuyuan_con {
		display: flex;
		margin: 14rpx auto 0;
		width: 630rpx;
		box-sizing: border-box;
		border-bottom: 1rpx solid #666666;
		overflow-x: scroll;
		overflow-y: hidden;
	}

	.xuyuan_head>view:nth-of-type(2) {
		font-size: 24rpx;
	}

	.xuyuan_head {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 28rpx;
		padding: 0 24rpx;
		box-sizing: border-box;
		color: #ffffff;
	}

	.xuyuan {
		width: 690rpx;
		/* height: 432rpx; */
		background: #222222;
		/* border: 2rpx solid #FFFFFF; */
		border-radius: 1rpx;
		margin: 24rpx auto 0;
		padding-top: 24rpx;
		box-sizing: border-box;
	}

	.pop_btn {
		width: 484rpx;
		height: 68rpx;
		background: #000000;
		border: 2rpx solid #2FB4FF;
		border-radius: 6rpx;
		font-size: 32rpx;
		color: #2FB4FF;
		margin: 50rpx auto 0;
		display: flex;
		justify-content: center;
		align-items: center;
	}


	.pop_con {
		height: 440rpx;
		margin: auto;
		padding: 0rpx 36rpx;
		font-size: 24rpx;
		line-height: 36rpx;
		color: #FFFFFF;
		box-sizing: border-box;
		overflow-y: scroll;
	}

	.pop_title {
		/* font-family: 'zcq'; */
		font-size: 40rpx;
		color: #96FFFE;
		height: 128rpx;
		line-height: 128rpx;
		text-align: center;
	}

	.pop {
		width: 543rpx;
		height: 801rpx;
		padding-top: 192rpx;
		box-sizing: border-box;
		/* background: #FFFFFF; */
		/* border-radius: 20rpx; */
	}

	.p_t_r {
		position: absolute;
		top: -20rpx;
		right: -10rpx;
		width: 32rpx;
		height: 32rpx;
	}


	.footer>image {
		width: 212rpx;
		height: 70rpx;
	}

	/* .footer>image:nth-of-type(3) {
		width: 317rpx;
		height: 106rpx;
		position: absolute;
		top: 20rpx;
		left: 0;
		right: 0;
		margin: auto;
		z-index: 11;
	} */

	.jiesuo {
		margin: auto;
		width: 317rpx !important;
		height: 106rpx !important;

	}

	.footer {
		width: 750rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: relative;
		position: fixed;
		bottom: 0rpx;
		right: 0;
		left: 0;
		margin: auto;
		background: #0D0D0D;
		padding: 30rpx 60rpx;
		box-sizing: border-box;
	}

	.xuanfu image {
		width: 77rpx;
		height: 77rpx;
		margin-top: 20rpx;
	}

	.xuanfu {
		position: fixed;
		bottom: 391rpx;
		right: 20rpx;
		width: 77rpx;
		z-index: 21;
	}

	.shop_con {
		padding:5rpx 10rpx 6rpx;
		box-sizing: border-box;
		line-height: 40rpx;
		/* background: #000000; */
		border-radius: 0 0 10rpx 10rpx;
		font-size: 26rpx;
		color: rgba(255, 255, 255, 0.6);
		text-align: center;
	}


	.item_head>view:nth-of-type(1) {
		width: 100%;
		position: absolute;
		background: rgba(255, 255, 255, .7);
		/* border-radius: 0 7rpx 0 0; */
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
		bottom: 0rpx;
		left: 0rpx;
		padding: 6rpx 14rpx;
		box-sizing: border-box;
	}

	.mengban {
		width: 100%;
		height: 100%;
		position: absolute;
		background: rgba(0, 0, 0, 0.8) !important;
		top: 0;
		left: 0;
	}

	.item_head>image {
		width: 193rpx;
		height: 264rpx;
	}

	.item_head {
		width: 193rpx;
		height: 264rpx;
		position: relative;
	}

	.shop_item {
		width: 193rpx;
		margin-top: 10rpx;
		position: relative;
		box-sizing: border-box;
		color: #FFFFFF;

	}

	.shop>.shop_item:nth-child(3n+2) {
		margin: 10rpx 26rpx 0;
	}

	.shop {
		width: 690rpx;
		min-height: 664rpx;
		background: rgba(255, 255, 255, 0.08);
		border-radius: 10px;
		margin: 0rpx auto;
		display: flex;
		/* justify-content: center; */
		flex-wrap: wrap;
		padding: 10rpx 30rpx;
		box-sizing: border-box;
		font-size: 24rpx;
	}

	.cate_sel {
		background: linear-gradient(0deg, #1AC762 0%, #35ED85 100%) !important;
		color: #000 !important;
	}

	.cate>view {
		padding: 4rpx 20rpx;
		/* border: 3rpx solid; */
		border-radius: 10rpx;
		margin-right: 30rpx;
		font-size: 30rpx;
		color: #FFFFFF;
		margin-top: 20rpx;
		background: #444444;
	}

	.cate {
		width: 690rpx;
		margin: 30rpx auto;
		display: flex;
		flex-wrap: wrap;
	}

	.qiehuan {
		display: flex;
		/* justify-content: space-between; */
		align-items: center;
		width: 690rpx;
		margin: 0 auto;
		box-sizing: border-box;
		/* font-family: 'zcq'; */
		/* font-weight: bold; */
	}

	.qiehuan>view {
		/* flex: 1; */
		text-align: center;
		margin-right: 30rpx;
	}

	.wzs {
		background: #E6E6E6;
		border-radius: 10rpx;
		color: #999999;
		padding: 15rpx 40rpx;
		font-size: 30rpx;
	}

	.xzs {
		background: linear-gradient(0deg, #1AC762 0%, #35ED85 100%);
        border-radius: 10rpx;
		color: #000000;
		padding: 15rpx 40rpx;
		font-size: 30rpx;
		/* font-size: 42rpx;
		color: #FF7514;
		-webkit-text-stroke: 1rpx #FFFFFF;
		text-stroke: 1rpx #FFFFFF;
		text-shadow: 2rpx 2rpx 10rpx #FFFFFF; */
	}

	.title_ipt {
		display: flex;
		align-items: center;
		margin: 20rpx auto;
		border-radius: 30rpx;
		padding-left: 30rpx;
		width: 652rpx;
		height: 64rpx;
		background: rgba(0, 0, 0, 0.7);
		border-radius: 32rpx;
		box-sizing: border-box;
	}

	.title_ipt>image {
		width: 26rpx;
		height: 26rpx;
	}

	.title_ipt>input {
		width: 77%;
		height: 60rpx;
		box-sizing: border-box;
		border-radius: 105rpx;
		font-size: 28rpx;
		line-height: 60rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(255, 255, 255, 0.6);
		padding-left: 20rpx;
	}

	.title_ipt>view {
		width: 94rpx;
		height: 35rpx;
		background: linear-gradient(0deg, #1AC762 0%, #35ED85 100%);
		border-radius: 18rpx;
		font-size: 23rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #111111;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 20rpx;
	}

	.redu {
		position: absolute;
		bottom: 65rpx;
		left: 0;
		right: 0;
		margin: auto;
		width: 694rpx;
		height: 108rpx;
		background: rgba(22, 22, 22, 0.6);
		padding: 16rpx 20rpx;
		box-sizing: border-box;
		color: #FFFFFF;
		font-size: 20rpx;
		border-radius: 0 0 7rpx 7rpx;
	}

	.header_title>view:nth-of-type(2) {
		width: 520rpx;
		text-align: center;
		/* margin: auto; */
	}

	.header_title>view:nth-of-type(1) {
		display: flex;
		align-items: center;
	}

	.header_title image {
		width: 48rpx;
		height: 48rpx;
	}

	.header_title {
		height: 70rpx;
		line-height: 70rpx;
		width: 100%;
		box-sizing: border-box;
		font-weight: bold;
		display: flex;
		align-items: center;
		padding-left: 30rpx;
		box-sizing: border-box;
	}

	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}

	.head {
		position: fixed;
		top: 0;
		z-index: 20;
	}

	.header {
		width: 750rpx;
		height: 489rpx;
		background: #FFFFFF;
		font-size: 32rpx;
		color: #FFFFFF;
		box-sizing: border-box;
		position: absolute;
		top: 0;
		z-index: 15;
	}

	.content {
		padding-bottom: 120rpx;
		/* background: #FAFAFA; */
		padding-top: 489rpx;
	}
</style>
